import { postParam } from '@/utils/request'

export const highFrequencyTreatmentRankingTabList = [
  {
    name: '企业',
    value: 3
  },
  {
    name: '车辆',
    value: 2
  },
  {
    name: '司机',
    value: 1
  }
]

export type HighFrequencyTreatmentRankingDataRequest = {
  entId?: string
  /** 类型 - 1: 人; 2: 车; 3: 企业 */
  type?: number
  /** top数量 */
  topNum: number
}

export type HighFrequencyTreatmentRankingDataResponse = {
  /** 企业名称/车牌号/司机姓名  */
  name?: string
  /** 行业/车辆类型/人员类型 */
  typeName: string
  /** 治理次数 */
  number: number
  /** 环比 */
  huanBiScope: string
}

/**
 * 高频治理排行列表数据
 *
 * @param params
 * @returns
 */
export const getHighFrequencyTreatmentRankingData = async (
  params: HighFrequencyTreatmentRankingDataRequest
) => {
  const { data, suc, message } = await postParam<
    HighFrequencyTreatmentRankingDataResponse[]
  >('/code/api/dp3/handOrder', params)

  if (suc) {
    return data
  } else {
    Promise.reject(message)
  }
}
